﻿SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON

GO


CREATE PROCEDURE [dbo].[bhp_temp_ModBlogStructure]
AS
BEGIN

	DECLARE
		@BlogTabId					INT,
		@BlogTagsTabId		INT

	SELECT @BlogTabId = id FROM n_Tree t WHERE t.name = 'BLOG_POSTS' AND parent = 0
	SELECT @BlogTagsTabId = id FROM n_Tree t WHERE t.name = 'BLOG_TAGS' AND parent = 0
	
	
	-- BLOG_POSTS.site
	EXEC [dbo].[n_ColFAdd] @rel = @BlogTabId, @name = N'site', @typ = 1, @siz1 = 1000, @siz2 = 1, @user = 900900
	INSERT INTO bht_Columns (ColumnId, DisplayName, HideForEdition)
	SELECT
		id, N'Site ID', 1
	FROM
		n_Tree t
	WHERE
		parent = @BlogTabId
		AND name = N'site'
		
	-- BLOG_TAGS.site
	EXEC [dbo].[n_ColFAdd] @rel = @BlogTagsTabId, @name = N'site', @typ = 1, @siz1 = 1000, @siz2 = 1, @user = 900900
	INSERT INTO bht_Columns (ColumnId, DisplayName, HideForEdition)
	SELECT
		id, N'Site ID', 1
	FROM
		n_Tree t
	WHERE
		parent = @BlogTagsTabId
		AND name = N'site'

END
GO

EXEC [bhp_temp_ModBlogStructure]
GO

DROP PROCEDURE [bhp_temp_ModBlogStructure]